<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="zhcms.framework.*" %> 
<%@ page import="zhcms.cms.*" %> 
<%@ page import="zhcms.tool.*" %> 
<%
//设置缓存
String url=request.getScheme()+"://"+request.getHeader("host")+request.getRequestURI();   
if(request.getQueryString()!=null) url+="?"+request.getQueryString();
//System.out.println(url);
GyCache gycache=new GyCache(10,url);
gycache.cacheCheck(application.getRealPath("/"));
String iscache=gycache.getCacheGetZ();
//System.out.println(iscache);
//设置输出内容
String OutContent="";

String listid="";
listid=request.getParameter("listid");
String pageid="";
pageid=request.getParameter("p");
//进行参数判断
if(GyHtmlConvertor.sql_inj(listid)==true)
{
	out.println("<script language=javascript>alert(\"对不起，传递的参数有非法字符！\");history.go(-1);</script>");
}
int pageb;    //存储当前页码
if(pageid==null)
   pageb=1;
else 
   pageb=Integer.parseInt(pageid);


if(iscache.equals("n") || iscache.equals("u"))
{
	//获取系统的模板参数
//GyTest t=new GyTest("/template/Index.html","UTF-8");
GyT t=new GyT();
t.setFrontSeparator("{@#");
t.setBackSeparator("#@}");
t.setfilename("/template/List.html");

GySystem gys=new GySystem();
t.setInVtrParameter("SiteName", gys.getSiteName());
t.setInVtrParameter("SiteEMail", gys.getSiteEMail());
t.setInVtrParameter("SiteUrl", gys.getSiteUrl());
t.setInVtrParameter("SystemVersion", gys.getSystemVersion());

GyArticleList gyal=new GyArticleList();
int countnum=gyal.listcount(listid);
gyal.setColumnInfo(listid);
t.setInVtrParameter("ColumnName", gyal.getColumnName());

//System.out.println("countnum"+countnum);
String pageStr="";
String islist="1";
ArrayList<HashMap<String, String>> gyListInFor;
gyListInFor=new ArrayList<HashMap<String, String>>();
if(countnum>0)
{
	islist="1";
	gyListInFor=gyal.getAllList(pageb,listid);
	pageStr=gyal.getPageStr();
	//System.out.println(lyblist.getPageStr());
	
}
else
{
	islist="0";
	gyListInFor=null;
	pageStr="";
}

t.setInIfParameter("islist", islist);
t.setInForParameter("list", gyListInFor);
t.setInVtrParameter("pages", pageStr);

	ArrayList<HashMap<String, String>> P_9w2489xu;
P_9w2489xu=new ArrayList<HashMap<String, String>>();
GyTablseToList Cl_lxb0mv =new GyTablseToList();
P_9w2489xu=Cl_lxb0mv.getAllList("select Id,ColumnCode,ColumnName,AddDate,Title,ViewNum from gyhy_content where 1=1 order by ViewNum desc limit 0 , 10");
t.setInForParameter("tuijianlist", P_9w2489xu);

t.parse("UTF-8");
OutContent=t.Out();

	//建立缓存
	if(iscache.equals("n"))
	{
		gycache.WriteNewFile(OutContent,"UTF-8");
	}
	else if(iscache.equals("u"))
	{
		gycache.WriteUpdateFile(OutContent,"UTF-8");
	}

}
else 
{
	gycache.getContent("UTF-8");
	OutContent=gycache.getCacheReturnS();
}
out.println(OutContent);
%>